package com.yaodian100.mall.member.web;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.apache.struts2.ServletActionContext;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.yaodian100.core.common.dao.impl.CommonCriteria;
import com.yaodian100.core.common.exception.CoreException;
import com.yaodian100.core.common.service.BaseManager;
import com.yaodian100.core.common.utils.JspUtil;
import com.yaodian100.core.mail.service.MailService;
import com.yaodian100.core.menu.service.MenuService;
import com.yaodian100.core.template.service.TemplateService;
import com.yaodian100.ec.common.EnvParameters;
import com.yaodian100.ec.delivery.service.DeliveryRuleService;
import com.yaodian100.ec.member.entity.Member;
import com.yaodian100.ec.order.entity.OrderProduct;
import com.yaodian100.ec.order.entity.OrderProductDetail;
import com.yaodian100.ec.order.entity.Orders;
import com.yaodian100.ec.order.entity.ServiceOrderProduct;
import com.yaodian100.ec.order.entity.ServiceOrders;
import com.yaodian100.ec.order.service.OrderService;
import com.yaodian100.ec.order.service.ServiceOrderService;
import com.yaodian100.ec.order.service.impl.ServiceOrderHelper;
import com.yaodian100.ec.payment.entity.ThirdPartyTransfer;
import com.yaodian100.ec.product.entity.Product;
import com.yaodian100.ec.product.entity.SpecificationInventory;
import com.yaodian100.ec.product.entity.SpecificationMajor;
import com.yaodian100.ec.product.service.Product2Service;
import com.yaodian100.ec.supplierapply.entity.SupplierApply;
import com.yaodian100.ec.supplierapply.service.SupplierApplyService;

/**
 * 
 * @author apple.chang
 * 
 */
public class ServiceOrderAction extends ActionSupport {
	private static Logger LOGGER = LoggerFactory.getLogger(ServiceOrderAction.class);
	private String addOnType = "10";
	/**
     * 
     */
	private static final long serialVersionUID = -5798297131850272636L;
	@Resource
	private BaseManager baseMgr;
	@Resource
	private ServiceOrderService serviceOrderService;
	private String accessaryDescription;
	private String receiverAddr;
	private String receiverArea;
	private String receiverCity;
	private String receiverExt;
	private String receiverMobile;
	private String receiverPhone;
	private String receiverPhoneArea;
	private String receiverProvince;
	private String receiverZip;
	private String receiverName;
	private String reason;
	private String description;
	private String srcType = "0";
	private String orderId;
	private String b2eId;
	private String prodTp;
	private String orderProdId;
	private String paymentTp;

	private String serviceId;
	// 列印用
	private String serviceOrderId;
	// 显示至页面用
	private ServiceOrders serviceOrder;
	private Orders order;
	private Collection<ServiceOrderProduct> serviceOrderProducts;
	// 檢測重覆送出用
	private String token;
	private String isResubmit;
	private String sysMessage;
	@Resource
	private OrderService orderService;
	@Resource
	private TemplateService velocityService;
	@Resource
	private MailService mailService;
	@Resource
	private EnvParameters envParameters;
	@Resource
	private MenuService menuService;

	private String quotaFilledId;
	private Map<String, String> provincesMap;
	@Autowired
	private DeliveryRuleService deliveryRuleService;
	private ThirdPartyTransfer thirdpartyTransfer;
	@Resource
	private Product2Service product2Service;
	private List<List<SpecificationMajor>> prodMajors;
	private List<Map<String, SpecificationInventory>> prodInvMaps;
	@Resource
	private SupplierApplyService supplierApplyService;

	private void setServiceOrderAndOrderProducts() {
		ServiceOrders serviceOrder = (ServiceOrders) baseMgr.get(ServiceOrders.class, serviceOrderId);
		Orders order = (Orders) baseMgr.get(Orders.class, serviceOrder.getOrderId());
		this.serviceOrder = serviceOrder;
		this.order = order;
		DetachedCriteria dc = DetachedCriteria.forClass(ServiceOrderProduct.class);
		dc.add(Restrictions.eq("serviceId", serviceOrderId));
		Object[] objs = baseMgr.findByCriteria(dc);
		Collection<ServiceOrderProduct> serviceOrderProducts = new ArrayList<ServiceOrderProduct>();
		for (Object obj : objs) {
			ServiceOrderProduct sop = (ServiceOrderProduct) obj;
			serviceOrderProducts.add(sop);
		}
		this.serviceOrderProducts = serviceOrderProducts;
		if ("50".equals(this.serviceOrder.getPaymentTp()) || "70".equals(this.serviceOrder.getPaymentTp())
				|| "80".equals(this.serviceOrder.getPaymentTp())) {
			thirdpartyTransfer = (ThirdPartyTransfer) baseMgr.get(ThirdPartyTransfer.class, StringUtils.defaultString(order
					.getPaymentId()));
		}
		this.serviceOrder = isReturnAddressValid(serviceOrder);
	}

	public String changeProductPrint() {
		setServiceOrderAndOrderProducts();
		return "changeProductPrint";
	}

	public String returnProductPrint() {
		setServiceOrderAndOrderProducts();
		return "returnProductPrint";
	}

	public String returnProduct() {
		if (serviceId != null && serviceId.length() > 0) {
			ServiceOrders so = (ServiceOrders) baseMgr.get(ServiceOrders.class, serviceId);
			this.serviceOrder = so;
			// this.serviceOrderProducts = so.getServiceOrderProducts();

			CommonCriteria cc = new CommonCriteria();
			cc.addEq("serviceId", serviceId);
			this.serviceOrderProducts = serviceOrderService.getServiceOrderProdList(0, -1, cc,
					new String[] { "serviceProdId" });
			this.serviceOrder = isReturnAddressValid(so);

		} else {
			ServiceOrders so = null;
			String[] prodSpecIds = null;
			String[] qtys = null;
			if (ActionContext.getContext().getParameters().get("prodSpecId") instanceof String) {
				String prodSpecId = (String) ActionContext.getContext().getParameters().get("prodSpecId");
				String qty = (String) ActionContext.getContext().getParameters().get("qty");
				prodSpecIds = new String[] { prodSpecId };
				qtys = new String[] { qty };

			} else {
				prodSpecIds = (String[]) ActionContext.getContext().getParameters().get("prodSpecId");
				qtys = (String[]) ActionContext.getContext().getParameters().get("qty");
			}

			OrderProduct op = (OrderProduct) baseMgr.get(OrderProduct.class, Long.valueOf(orderProdId));

			Long orderProdIdLong = op.getOrderProdId();
			if (op.getProdTp().equals(Product.PRODUCT_TYPE.NPICKM.getValue())) {
				String quantityForAllOrderProductDetail = qtys[0];
				// 退n選m的時候，prodSpecId 改抓 orderDetail 裡的 specSpecId
				CommonCriteria criteria = new CommonCriteria();
				criteria.addEq("orderProdId", orderProdIdLong);
				List<OrderProductDetail> orderDetailOfNPickM = this.orderService
						.getOrderDetailListByOrderProdId(orderProdIdLong);
				prodSpecIds = new String[orderDetailOfNPickM.size()];
				qtys = new String[orderDetailOfNPickM.size()];
				for (int i = 0; i < orderDetailOfNPickM.size(); i++) {
					OrderProductDetail orderProductDetail = orderDetailOfNPickM.get(i);
					prodSpecIds[i] = orderProductDetail.getProdSpecId();
					qtys[i] = quantityForAllOrderProductDetail;
				}
			}

			String theOrderId = op.getOrderId();
			String memberId = com.yaodian100.mall.util.JspUtil.memberId();
			HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
					ServletActionContext.HTTP_REQUEST);
			String host = request.getHeader("X-Forwarded-For");
			if (StringUtils.isBlank(host)) {
				host = StringUtils.defaultString(request.getRemoteAddr(), "0.0.0.0");
			} else if (host.length() > 100) {
				host = host.substring(0, 100);
			}
			ServiceOrderHelper soh = serviceOrderService.returnProductByOrderProdId(orderProdId, memberId,
					accessaryDescription, paymentTp, receiverName, receiverAddr, receiverArea, receiverCity, receiverExt, host,
					receiverMobile, receiverPhone, receiverPhoneArea, receiverProvince, receiverZip, reason, description, String
							.valueOf(ServiceOrders.SERVICE_TYPE.RETURN.getValue()), theOrderId, "", prodSpecIds, qtys, "00", null,
					null);

			this.serviceOrder = soh.getSo();
			this.serviceOrder.setServiceOrderProducts(soh.getServiceOrderProducts());
			this.serviceOrderProducts = soh.getServiceOrderProducts();

		}
		if ("50".equals(this.serviceOrder.getPaymentTp()) || "70".equals(this.serviceOrder.getPaymentTp())
				|| "80".equals(this.serviceOrder.getPaymentTp())) {
			Orders thisOrder = (Orders) baseMgr.get(Orders.class, this.serviceOrder.getOrderId());

			thirdpartyTransfer = (ThirdPartyTransfer) baseMgr.get(ThirdPartyTransfer.class, StringUtils
					.defaultString(thisOrder.getPaymentId()));
		}
		if (this.serviceOrder.getSrcType() == 1) {
			return "returnProductResult";
		} else if (this.serviceOrder.getSrcType() == 2) {
			return "changeProductResult";
		} else {
			return "cancelOrder";
		}

	}

	public String toReturnProduct() {
		String returnPage = checkForReturnOrChange();
		if (returnPage != null) {
			return returnPage;
		}
		srcType = "1";
		return "returnProduct";
	}

	private String checkForReturnOrChange() {
		Object[] sops = baseMgr.queryByHql("from ServiceOrderProduct where orderProdId=?", new Object[] { orderProdId });
		List serviceIdList = new ArrayList();
		for (Object obj : sops) {
			ServiceOrderProduct sop = (ServiceOrderProduct) obj;
			if (serviceIdList.size() > 0) {
				boolean isExist = false;
				for (int i = 0; i < serviceIdList.size(); i++) {
					if (serviceIdList.get(i).equals(sop.getServiceId())) {
						isExist = true;
					}
				}
				if (!isExist) {
					serviceIdList.add(sop.getServiceId());
				}
			} else {
				serviceIdList.add(sop.getServiceId());
			}
		}
		for (int i = 0; i < serviceIdList.size(); i++) {
			// if (sops != null && sops.length > 0) {
			ServiceOrders so = (ServiceOrders) baseMgr.get(ServiceOrders.class, (String) serviceIdList.get(i));
			if (so != null && so.getReasonTp() != null
					&& so.getReasonTp().equals(ServiceOrders.REASON_TYPE.USER_RETURN_SHIPFARE.getValue())) {
				//
			} else {
				// this.serviceId = ((ServiceOrderProduct) sops[0]).getServiceId();
				this.serviceId = (String) serviceIdList.get(i);
				if (so.getSrcType() == 1) {
					return returnProduct();
				} else {
					return changeProduct();
				}
			}

		}
		return null;
	}

	public String toChangeProduct() {
		String returnPage = checkForReturnOrChange();
		if (returnPage != null) {
			return returnPage;
		}
		srcType = "2";
		return "changeProduct";
	}

	public String changeProductApply() {
		prodMajors = new ArrayList<List<SpecificationMajor>>();
		prodInvMaps = new ArrayList<Map<String, SpecificationInventory>>();
		String returnPage = checkForReturnOrChange();
		OrderProduct op = (OrderProduct) baseMgr.get(OrderProduct.class, Long.valueOf(orderProdId));
		// 地址簿-省
		provincesMap = deliveryRuleService.getServiceOrderProvinces(op.getOrderId());
		if (returnPage != null) {
			return returnPage;
		}
		Product product = (Product) baseMgr.get(Product.class, op.getProdId());
		for (OrderProductDetail opd : op.getOrderProductDetail()) {
			Product productD = (Product) baseMgr.get(Product.class, opd.getProdId());
			if (null != productD.getSpecMajors()) {
				List<SpecificationMajor> prodMajor = new ArrayList<SpecificationMajor>();
				for (SpecificationMajor major : productD.getSpecMajors()) {
					if ("N".equals(major.getIsDelete())) {
						prodMajor.add(major);
					}
				}
				Map<String, SpecificationInventory> prodInvMap = product2Service.getSpecificationInventoryMap(opd.getProdId());
				prodMajors.add(prodMajor);
				prodInvMaps.add(prodInvMap);
			}
		}
		return "changeProductApply";
	}

	public String returnProductApply() {
		String returnPage = checkForReturnOrChange();
		OrderProduct op = (OrderProduct) baseMgr.get(OrderProduct.class, Long.valueOf(orderProdId));
		// 地址簿-省
		provincesMap = deliveryRuleService.getServiceOrderProvinces(op.getOrderId());
		if (returnPage != null) {
			return returnPage;
		}

		return "returnProductApply";
	}

	private ServiceOrders orderMaster(ServiceOrders serviceOrder, String orderId) {
		Member member = null;
		member = (Member) baseMgr.get(Member.class, com.yaodian100.mall.util.JspUtil.memberId());

		// 配件状况
		serviceOrder.setAccessaryDescription(accessaryDescription);
		Date date = new Date();
		serviceOrder.setCreateDate(date);
		serviceOrder.setCreateUser("SYSTEM");
		serviceOrder.setLoginId(member.getLoginId());
		serviceOrder.setMemberId(member.getMemberId());
		serviceOrder.setMemberName(member.getName());
		serviceOrder.setMemo(" ");
		serviceOrder.setOrderSt("10");
		serviceOrder.setReturnSt("00");
		serviceOrder.setReasonTp("0");
		serviceOrder.setReturnBenefit(new BigDecimal(0));
		serviceOrder.setReturnBonus(new BigDecimal(0));
		serviceOrder.setReturnCoupon(new BigDecimal(0));
		serviceOrder.setReturnCash(new BigDecimal(0));
		serviceOrder.setReturnMyWallet(new BigDecimal(0));
		serviceOrder.setReturnShipfare(new BigDecimal(0));
		serviceOrder.setReturnCodFee(new BigDecimal(0));
		serviceOrder.setRealBenefit(new BigDecimal(0));
		serviceOrder.setRealBonus(new BigDecimal(0));
		serviceOrder.setRealCoupon(new BigDecimal(0));
		serviceOrder.setRealCash(new BigDecimal(0));
		serviceOrder.setRealMyWallet(new BigDecimal(0));
		serviceOrder.setRealShipfare(new BigDecimal(0));
		serviceOrder.setRealCodFee(new BigDecimal(0));

		serviceOrder.setPaymentTp(paymentTp);
		serviceOrder.setModifyUser("SYSTEM");
		serviceOrder.setServiceDt(date);
		serviceOrder.setReceiverName(receiverName);
		serviceOrder.setReceiverAddr(receiverAddr);
		serviceOrder.setReceiverArea(receiverArea);
		serviceOrder.setReceiverCity(receiverCity);
		if (receiverExt == null || receiverExt.length() == 0) {
			receiverExt = " ";
		}
		if (receiverMobile == null || receiverMobile.length() == 0) {
			receiverMobile = " ";
		}
		if (receiverPhone == null || receiverPhone.length() == 0) {
			receiverPhone = " ";
		}
		if (receiverPhoneArea == null || receiverPhoneArea.length() == 0) {
			receiverPhoneArea = " ";
		}
		serviceOrder.setReceiverExt(receiverExt);
		serviceOrder.setReceiverMobile(receiverMobile);
		serviceOrder.setReceiverPhone(receiverPhone);
		serviceOrder.setReceiverPhoneArea(receiverPhoneArea);

		serviceOrder.setReceiverProvince(receiverProvince);
		serviceOrder.setReceiverZip(receiverZip);
		serviceOrder.setReason(reason);
		serviceOrder.setDescription(description);
		serviceOrder.setSrcType(Integer.parseInt(srcType));
		serviceOrder.setOrderId(orderId);
		HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
		String host = request.getHeader("X-Forwarded-For");
		if (StringUtils.isBlank(host)) {
			host = StringUtils.defaultString(request.getRemoteAddr(), "0.0.0.0");
		} else if (host.length() > 100) {
			host = host.substring(0, 100);
		}
		serviceOrder.setClientIp(host);
		serviceOrder.setB2eId(b2eId);
		serviceOrder.setReceiverEmail(member.getEmail());

		Orders order = (Orders) baseMgr.get(Orders.class, orderId);

		serviceOrder.setCodFee(order.getCodFee());
		serviceOrder.setReturnCodFee(serviceOrder.getCodFee());
		serviceOrder.setRealCodFee(serviceOrder.getCodFee());

		return serviceOrder;
	}

	public String changeProduct() {
		try {
			if (serviceId != null && serviceId.length() > 0) {
				ServiceOrders so = (ServiceOrders) baseMgr.get(ServiceOrders.class, serviceId);
				this.serviceOrder = so;
				CommonCriteria cc = new CommonCriteria();
				cc.addEq("serviceId", serviceId);
				this.serviceOrderProducts = serviceOrderService.getServiceOrderProdList(0, -1, cc,
						new String[] { "serviceProdId" });

				this.serviceOrder = isReturnAddressValid(so);
			} else {
				String[] specParameters = null;
				if (ActionContext.getContext().getParameters().get("prodSpecId") instanceof String) {
					String prodSpecId = (String) ActionContext.getContext().getParameters().get("prodSpecId");

					specParameters = new String[] { prodSpecId };

				} else {
					specParameters = (String[]) ActionContext.getContext().getParameters().get("prodSpecId");

				}
				OrderProduct op = (OrderProduct) baseMgr.get(OrderProduct.class, Long.valueOf(orderProdId));
				String theOrderId = op.getOrderId();
				String memberId = com.yaodian100.mall.util.JspUtil.memberId();
				HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
						ServletActionContext.HTTP_REQUEST);
				String host = request.getHeader("X-Forwarded-For");
				if (StringUtils.isBlank(host)) {
					host = StringUtils.defaultString(request.getRemoteAddr(), "0.0.0.0");
				} else if (host.length() > 100) {
					host = host.substring(0, 100);
				}
				ServiceOrderHelper soh = serviceOrderService.changeProductByOrderProdId(orderProdId, memberId,
						accessaryDescription, paymentTp, receiverName, receiverAddr, receiverArea, receiverCity, receiverExt, host,
						receiverMobile, receiverPhone, receiverPhoneArea, receiverProvince, receiverZip, reason, description,
						String.valueOf(ServiceOrders.SERVICE_TYPE.RETURN.getValue()), theOrderId, "", specParameters, null);
				this.serviceOrder = soh.getSo();
				this.serviceOrder.setServiceOrderProducts(soh.getServiceOrderProducts());
				this.serviceOrderProducts = soh.getServiceOrderProducts();
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if (this.serviceOrder.getSrcType() == 1) {
			return "returnProductResult";
		} else if (this.serviceOrder.getSrcType() == 2) {
			return "changeProductResult";
		} else {
			return "cancelOrder";
		}

	}

	private void updateOrder() {
		Orders order = (Orders) baseMgr.get(Orders.class, serviceOrder.getOrderId());
		if (serviceOrder.getSrcType() == ServiceOrders.SERVICE_TYPE.CANCEL.getValue()) {
			// user取消整张订单
			order.setOrderSt("81");
			for (OrderProduct op : order.getOrderProduct()) {
				op.setProdStatus(3);
				baseMgr.update(op);
			}
			baseMgr.update(order);
		} else {
			for (ServiceOrderProduct sop : serviceOrderProducts) {
				for (OrderProduct op : order.getOrderProduct()) {
					if (sop.getOrderProdId().equals(op.getOrderProdId())) {
						op.setProdStatus(serviceOrder.getSrcType());
						baseMgr.update(op);
					}
				}
			}

		}
	}

	public String toCancelOrder() {
		return "toCancelOrder";
	}

	public String cancelOrder() {
		Boolean isResubmit = JspUtil.isResubmit(token);
		this.isResubmit = String.valueOf(isResubmit);
		if (!isResubmit) {
			String memberId = com.yaodian100.mall.util.JspUtil.memberId();
			Orders order = orderService.get(orderId);
			try {
				if (order.getMemberId().equals(memberId)) {
					HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(
							ServletActionContext.HTTP_REQUEST);
					String host = request.getHeader("X-Forwarded-For");
					if (StringUtils.isBlank(host)) {
						host = StringUtils.defaultString(request.getRemoteAddr(), "0.0.0.0");
					} else if (host.length() > 100) {
						host = host.substring(0, 100);
					}
					this.serviceOrderService.cancelOrderByUser(orderId, description, reason, memberId, host, b2eId);
				} else {
					throw new CoreException("您无权操作本订单！");
				}
			} catch (CoreException ce) {
				sysMessage = ce.getMessage();
			}

			serviceOrderService.sendMail("member.cancelOrder", "订单" + order.getOrderId() + " 取消成功", order);
		}

		return "cancelOrder";
	}

	private ServiceOrders isReturnAddressValid(ServiceOrders so) {

		if (StringUtils.isBlank(so.getReturnAddr()) || StringUtils.isBlank(so.getReturnArea())
				|| StringUtils.isBlank(so.getReturnCity()) || StringUtils.isBlank(so.getReturnContact())
				|| StringUtils.isBlank(so.getReturnPhone()) || StringUtils.isBlank(so.getReturnProvince())
				|| StringUtils.isBlank(so.getReturnZip())) {

			SupplierApply defaultSupplier = supplierApplyService.get("000000");
			so.setIsReturnSupplier("N");
			so.setIsSelfShip("N");

			so.setReturnAddr(defaultSupplier.getReturnAddr());
			so.setReturnArea(defaultSupplier.getReturnArea());
			so.setReturnCity(defaultSupplier.getReturnCity());
			so.setReturnContact(defaultSupplier.getReturnContact());
			so.setReturnPhone(defaultSupplier.getReturnPhone());
			so.setReturnProvince(defaultSupplier.getReturnProvince());
			so.setReturnZip(defaultSupplier.getReturnZip());

		}
		return so;

	}

	public String index() {
		return "index";
	}

	public void populateServiceOrderProd(OrderProduct op, ServiceOrderProduct sop) {
		BeanUtils.copyProperties(op, sop);
	}

	/**
	 * @return the addOnType
	 */
	public String getAddOnType() {
		return addOnType;
	}

	/**
	 * @param addOnType the addOnType to set
	 */
	public void setAddOnType(String addOnType) {
		this.addOnType = addOnType;
	}

	/**
	 * @return the baseMgr
	 */
	public BaseManager getBaseMgr() {
		return baseMgr;
	}

	/**
	 * @param baseMgr the baseMgr to set
	 */
	public void setBaseMgr(BaseManager baseMgr) {
		this.baseMgr = baseMgr;
	}

	/**
	 * @return the serviceOrderService
	 */
	public ServiceOrderService getServiceOrderService() {
		return serviceOrderService;
	}

	/**
	 * @param serviceOrderService the serviceOrderService to set
	 */
	public void setServiceOrderService(ServiceOrderService serviceOrderService) {
		this.serviceOrderService = serviceOrderService;
	}

	/**
	 * @return the accessaryDescription
	 */
	public String getAccessaryDescription() {
		return accessaryDescription;
	}

	/**
	 * @param accessaryDescription the accessaryDescription to set
	 */
	public void setAccessaryDescription(String accessaryDescription) {
		this.accessaryDescription = accessaryDescription;
	}

	/**
	 * @return the receiverAddr
	 */
	public String getReceiverAddr() {
		return receiverAddr;
	}

	/**
	 * @param receiverAddr the receiverAddr to set
	 */
	public void setReceiverAddr(String receiverAddr) {
		this.receiverAddr = receiverAddr;
	}

	/**
	 * @return the receiverArea
	 */
	public String getReceiverArea() {
		return receiverArea;
	}

	/**
	 * @param receiverArea the receiverArea to set
	 */
	public void setReceiverArea(String receiverArea) {
		this.receiverArea = receiverArea;
	}

	/**
	 * @return the receiverCity
	 */
	public String getReceiverCity() {
		return receiverCity;
	}

	/**
	 * @param receiverCity the receiverCity to set
	 */
	public void setReceiverCity(String receiverCity) {
		this.receiverCity = receiverCity;
	}

	/**
	 * @return the receiverExt
	 */
	public String getReceiverExt() {
		return receiverExt;
	}

	/**
	 * @param receiverExt the receiverExt to set
	 */
	public void setReceiverExt(String receiverExt) {
		this.receiverExt = receiverExt;
	}

	/**
	 * @return the receiverMobile
	 */
	public String getReceiverMobile() {
		return receiverMobile;
	}

	/**
	 * @param receiverMobile the receiverMobile to set
	 */
	public void setReceiverMobile(String receiverMobile) {
		this.receiverMobile = receiverMobile;
	}

	/**
	 * @return the receiverPhone
	 */
	public String getReceiverPhone() {
		return receiverPhone;
	}

	/**
	 * @param receiverPhone the receiverPhone to set
	 */
	public void setReceiverPhone(String receiverPhone) {
		this.receiverPhone = receiverPhone;
	}

	/**
	 * @return the receiverPhoneArea
	 */
	public String getReceiverPhoneArea() {
		return receiverPhoneArea;
	}

	/**
	 * @param receiverPhoneArea the receiverPhoneArea to set
	 */
	public void setReceiverPhoneArea(String receiverPhoneArea) {
		this.receiverPhoneArea = receiverPhoneArea;
	}

	/**
	 * @return the receiverProvince
	 */
	public String getReceiverProvince() {
		return receiverProvince;
	}

	/**
	 * @param receiverProvince the receiverProvince to set
	 */
	public void setReceiverProvince(String receiverProvince) {
		this.receiverProvince = receiverProvince;
	}

	/**
	 * @return the receiverZip
	 */
	public String getReceiverZip() {
		return receiverZip;
	}

	/**
	 * @param receiverZip the receiverZip to set
	 */
	public void setReceiverZip(String receiverZip) {
		this.receiverZip = receiverZip;
	}

	/**
	 * @return the reason
	 */
	public String getReason() {
		return reason;
	}

	/**
	 * @param reason the reason to set
	 */
	public void setReason(String reason) {
		this.reason = reason;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the srcType
	 */
	public String getSrcType() {
		return srcType;
	}

	/**
	 * @param srcType the srcType to set
	 */
	public void setSrcType(String srcType) {
		this.srcType = srcType;
	}

	/**
	 * @return the orderId
	 */
	public String getOrderId() {
		return orderId;
	}

	/**
	 * @param orderId the orderId to set
	 */
	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

	/**
	 * @return the b2eId
	 */
	public String getB2eId() {
		return b2eId;
	}

	/**
	 * @param b2eId the b2eId to set
	 */
	public void setB2eId(String b2eId) {
		this.b2eId = b2eId;
	}

	/**
	 * @return the prodTp
	 */
	public String getProdTp() {
		return prodTp;
	}

	/**
	 * @param prodTp the prodTp to set
	 */
	public void setProdTp(String prodTp) {
		this.prodTp = prodTp;
	}

	/**
	 * @return the orderProdId
	 */
	public String getOrderProdId() {
		return orderProdId;
	}

	/**
	 * @param orderProdId the orderProdId to set
	 */
	public void setOrderProdId(String orderProdId) {
		this.orderProdId = orderProdId;
	}

	/**
	 * @return the paymentTp
	 */
	public String getPaymentTp() {
		return paymentTp;
	}

	/**
	 * @param paymentTp the paymentTp to set
	 */
	public void setPaymentTp(String paymentTp) {
		this.paymentTp = paymentTp;
	}

	/**
	 * @return the receiverName
	 */
	public String getReceiverName() {
		return receiverName;
	}

	/**
	 * @param receiverName the receiverName to set
	 */
	public void setReceiverName(String receiverName) {
		this.receiverName = receiverName;
	}

	/**
	 * @return the serviceOrder
	 */
	public ServiceOrders getServiceOrder() {
		return serviceOrder;
	}

	/**
	 * @param serviceOrder the serviceOrder to set
	 */
	public void setServiceOrder(ServiceOrders serviceOrder) {
		this.serviceOrder = serviceOrder;
	}

	/**
	 * @return the serviceOrderProducts
	 */
	public Collection<ServiceOrderProduct> getServiceOrderProducts() {
		return serviceOrderProducts;
	}

	/**
	 * @param serviceOrderProducts the serviceOrderProducts to set
	 */
	public void setServiceOrderProducts(Collection<ServiceOrderProduct> serviceOrderProducts) {
		this.serviceOrderProducts = serviceOrderProducts;
	}

	/**
	 * @return the token
	 */
	public String getToken() {
		return token;
	}

	/**
	 * @param token the token to set
	 */
	public void setToken(String token) {
		this.token = token;
	}

	/**
	 * @return the isResubmit
	 */
	public String getIsResubmit() {
		return isResubmit;
	}

	/**
	 * @param isResubmit the isResubmit to set
	 */
	public void setIsResubmit(String isResubmit) {
		this.isResubmit = isResubmit;
	}

	/**
	 * @return the serviceOrderId
	 */
	public String getServiceOrderId() {
		return serviceOrderId;
	}

	/**
	 * @param serviceOrderId the serviceOrderId to set
	 */
	public void setServiceOrderId(String serviceOrderId) {
		this.serviceOrderId = serviceOrderId;
	}

	public String refund() {
		return "refund";
	}

	/**
	 * @return the serviceId
	 */
	public String getServiceId() {
		return serviceId;
	}

	/**
	 * @param serviceId the serviceId to set
	 */
	public void setServiceId(String serviceId) {
		this.serviceId = serviceId;
	}

	/**
	 * @return the quotaFilledId
	 */
	public String getQuotaFilledId() {
		return quotaFilledId;
	}

	/**
	 * @param quotaFilledId the quotaFilledId to set
	 */
	public void setQuotaFilledId(String quotaFilledId) {
		this.quotaFilledId = quotaFilledId;
	}

	/**
	 * @return the sysMessage
	 */
	public String getSysMessage() {
		return sysMessage;
	}

	/**
	 * @param sysMessage the sysMessage to set
	 */
	public void setSysMessage(String sysMessage) {
		this.sysMessage = sysMessage;
	}

	public Map<String, String> getProvincesMap() {
		return provincesMap;
	}

	public void setProvincesMap(Map<String, String> provincesMap) {
		this.provincesMap = provincesMap;
	}

	/**
	 * @return the thirdpartyTransfer
	 */
	public ThirdPartyTransfer getThirdpartyTransfer() {
		return thirdpartyTransfer;
	}

	/**
	 * @param thirdpartyTransfer the thirdpartyTransfer to set
	 */
	public void setThirdpartyTransfer(ThirdPartyTransfer thirdpartyTransfer) {
		this.thirdpartyTransfer = thirdpartyTransfer;
	}

	/**
	 * @return the prodMajors
	 */
	public List<List<SpecificationMajor>> getProdMajors() {
		return prodMajors;
	}

	/**
	 * @param prodMajors the prodMajors to set
	 */
	public void setProdMajors(List<List<SpecificationMajor>> prodMajors) {
		this.prodMajors = prodMajors;
	}

	/**
	 * @return the prodInvMap
	 */
	public List<Map<String, SpecificationInventory>> getProdInvMaps() {
		return prodInvMaps;
	}

	/**
	 * @param prodInvMap the prodInvMap to set
	 */
	public void setProdInvMaps(List<Map<String, SpecificationInventory>> prodInvMaps) {
		this.prodInvMaps = prodInvMaps;
	}

	public Orders getOrder() {
		return order;
	}

}